import { Widget } from '../../../models'
import { Viewer } from '../../../types'

/** 获取选择的操作控件 */
export function getWidgetSelection(viewer: Viewer) {
  const {
    activeWidget: widget,
    selection: { list: selected }
  } = viewer

  return ((selected.length && selected) || (widget && [widget]) || []) as Widget[]
}
